# import requests
# import json
#
# """
# with open(file="D:\\D盘桌面\\九年级物理空中课堂.txt", mode='r', encoding='utf-8') as f:
#     urls = f.read().split('\n')
# print(urls)"""
# urls = ["https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=19156&courseId=8629",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=19506&courseId=8631",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=19532&courseId=8632",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=19873&courseId=9122",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=19899&courseId=9302",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=20266&courseId=9476",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=20286&courseId=9680",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=20593&courseId=9760",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=20617&courseId=9766",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=20917&courseId=10121",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=20939&courseId=10122",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=21212&courseId=10419",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=21224&courseId=10423",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=21403&courseId=10674",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=21600&courseId=238",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=21883&courseId=249",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=21905&courseId=797",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=22287&courseId=847",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=22309&courseId=1132",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=22654&courseId=1249",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=22676&courseId=1588",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=23021&courseId=1668",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=23043&courseId=1767",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=23401&courseId=2029",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=23423&courseId=2225",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=23830&courseId=2210",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=23852&courseId=2625",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=23857&courseId=2845",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=24156&courseId=3104",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=24475&courseId=3254",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=24497&courseId=3379",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=24851&courseId=3699",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=24873&courseId=3700",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=25203&courseId=4058",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=25507&courseId=4259",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=25529&courseId=4490",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=25841&courseId=4607",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=25862&courseId=4785",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=26216&courseId=4908",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=26236&courseId=5066",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=26522&courseId=11260",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=26865&courseId=5240",
# "https://smile.shec.edu.cn/#/airClassroomTaskDetail?resource=26885&courseId=11270"]
#
#
# for url in urls:
#     print(url)
#     # 1.拿到页面源代码
#     api = "https://smile.shec.edu.cn/smile-index-service/api/index/registerResource/queryByLessonId/" + url[60:65]
#     print("api:", api)
#     resp = requests.post(url, params={}, headers={"Accept": "application/json, text/plain, */*",
#         "Accept-Encoding": "gzip, deflate, br",
#         "Accept-Language": "zh-CN,zh;q=0.9",
#         "Authorization": "[object Object]",
#         "Cache-Control": "no-cache",
#         "Connection": "keep-alive",
#         "Content-Length": "2",
#         "Content-Type": "application/json;charset=UTF-8",
#         "Cookie": "JSESSIONID=%7B%22persistedTime%22%3A1610277003624%2C%22updatedTime%22%3A1665055073596%2C%22sessionStartTime%22%3A1665048847683%2C%22sessionReferrer%22%3A%22%22%2C%22deviceId%22%3A%22276577e0edb673f7cba456b5383e62de-5364%22%2C%22LASTEVENT%22%3A%7B%22eventId%22%3A%22wondersLog_pv%22%2C%22time%22%3A1665055072853%7D%2C%22sessionUuid%22%3A5308778960878560%2C%22costTime%22%3A%7B%22wondersLog_unload%22%3A1665055073596%7D%2C%22userId%22%3A%221BA520C8-22B9-4369-A5F2-47A9D7DDB67C%22%2C%22utmCampaign%22%3A%22%E6%B5%A6%E4%B8%9C%E6%96%B0%E5%8C%BA%22%2C%22utmMedium%22%3A%22%E4%B8%8A%E6%B5%B7%E5%B8%82%E9%99%86%E8%A1%8C%E4%B8%AD%E5%AD%A6%E5%8D%97%E6%A0%A1%22%2C%22utmSource%22%3A%22%E5%88%9D%E4%BA%8C%22%2C%22utmContent%22%3A%2202%E7%8F%AD%22%2C%22utmTerm%22%3A%22%E5%AD%A6%E7%94%9F%22%2C%22superProperties%22%3A%7B%7D%2C%22recommend_code%22%3A8102700433298779%7D; JSESSIONID=%7B%22persistedTime%22%3A1610277003624%2C%22updatedTime%22%3A1665055073596%2C%22sessionStartTime%22%3A1665048847683%2C%22sessionReferrer%22%3A%22%22%2C%22deviceId%22%3A%22276577e0edb673f7cba456b5383e62de-5364%22%2C%22LASTEVENT%22%3A%7B%22eventId%22%3A%22wondersLog_pv%22%2C%22time%22%3A1665055072853%7D%2C%22sessionUuid%22%3A5308778960878560%2C%22costTime%22%3A%7B%22wondersLog_unload%22%3A1665055073596%7D%2C%22userId%22%3A%221BA520C8-22B9-4369-A5F2-47A9D7DDB67C%22%2C%22utmCampaign%22%3A%22%E6%B5%A6%E4%B8%9C%E6%96%B0%E5%8C%BA%22%2C%22utmMedium%22%3A%22%E4%B8%8A%E6%B5%B7%E5%B8%82%E9%99%86%E8%A1%8C%E4%B8%AD%E5%AD%A6%E5%8D%97%E6%A0%A1%22%2C%22utmSource%22%3A%22%E5%88%9D%E4%BA%8C%22%2C%22utmContent%22%3A%2202%E7%8F%AD%22%2C%22utmTerm%22%3A%22%E5%AD%A6%E7%94%9F%22%2C%22superProperties%22%3A%7B%7D%2C%22recommend_code%22%3A8102700433298779%7D; JWT_TOKEN=eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoie1wiaGlkXCI6MCxcInVzZXJuYW1lXCI6XCLmsojlpZXpo45cIixcInR5cGVcIjoxLFwiY2FzSWRcIjpcIjFCQTUyMEM4LTIyQjktNDM2OS1BNUYyLTQ3QTlEN0REQjY3Q1wiLFwic2lkXCI6OTEyOTEsXCJsb2dpblR5cGVcIjoxfSIsImp0aSI6IllXSXlaREF3T0RJdFlqbGlPQzAwT0Rjd0xUZ3haVFF0WlRKbVl6QXhaVGhsWlRKbCJ9.G_aCoQdAmbzexc74798FrjGUZxiZ0g2LTMe1UdZ9e0M; SERVERID=71801109ea72a915222dec9fbb1baa5c|1665056042|1665055994; wondersLog_smile_sdk=%7B%22persistedTime%22%3A1610277003624%2C%22updatedTime%22%3A1665056002162%2C%22sessionStartTime%22%3A1665048847683%2C%22sessionReferrer%22%3A%22%22%2C%22deviceId%22%3A%22276577e0edb673f7cba456b5383e62de-5364%22%2C%22LASTEVENT%22%3A%7B%22eventId%22%3A%22wondersLog_pv%22%2C%22time%22%3A1665055997148%7D%2C%22sessionUuid%22%3A5308778960878560%2C%22costTime%22%3A%7B%7D%2C%22userId%22%3A%221BA520C8-22B9-4369-A5F2-47A9D7DDB67C%22%2C%22utmCampaign%22%3A%22%E6%B5%A6%E4%B8%9C%E6%96%B0%E5%8C%BA%22%2C%22utmMedium%22%3A%22%E4%B8%8A%E6%B5%B7%E5%B8%82%E9%99%86%E8%A1%8C%E4%B8%AD%E5%AD%A6%E5%8D%97%E6%A0%A1%22%2C%22utmSource%22%3A%22%E5%88%9D%E4%BA%8C%22%2C%22utmContent%22%3A%2202%E7%8F%AD%22%2C%22utmTerm%22%3A%22%E5%AD%A6%E7%94%9F%22%2C%22superProperties%22%3A%7B%7D%2C%22recommend_code%22%3A8102700433298779%7D",
#         "Host": "smile.shec.edu.cn",
#         "Origin": "https://smile.shec.edu.cn",
#         "Pragma": "no-cache",
#         "Referer": "https://smile.shec.edu.cn/",
#         "Sec-Fetch-Dest": "empty",
#         "Sec-Fetch-Mode": "cors",
#         "Sec-Fetch-Site": "same-origin",
#         "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"
#     })
#     content = resp.text
#     print(content)
#     js = json.loads(content)
#     print(js)
#     break
#     # 2.提取和解析数据
#
